package com.news.web;

import java.io.IOException;
import java.io.Writer;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class HelloServlet
 */
@WebServlet("/hello")
public class HelloServlet extends HttpServlet {
	 
 
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		response.setCharacterEncoding("utf-8");
		response.setContentType("text/html; charset=UTF-8"); 
		Writer out=response.getWriter();
		out.append("<!DOCTYPE html>\r\n" );
		out.append("<html>\r\n");
		out.append("<head>\r\n");
		out.append("<meta charset=\"UTF-8\">\r\n");
		out.append("<title>Insert title here</title>\r\n");
		out.append("</head>\r\n");
		out.append("<body>");
		out.append("<h2>hello world!");
		out.append("</body>");
	}
 
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		 doGet(request, response);
	}

}
